// 泛型定义及使用
interface Res<T> {
  code: number
  message: string
  data: T
}

interface myMessage {
  id: string
  avatar: string
  nickName: string
}

interface myId {
  id: string
}

const XiaoMming: Res<myMessage> = {
  code: 123,
  message: '123',
  data: {
    id: '123',
    avatar: '456789',
    nickName: '789',
  },
}

const XiaoMei: Res<myId> = {
  code: 123,
  message: '123',
  data: {
    id: '123',
  },
}
console.log(XiaoMming, XiaoMei)
